package com.yonyou.pmclouds.outter;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yonyou.pmclouds.ApplicationConsts;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.discuss.entity.DiscussionVO;
import com.yonyou.pmclouds.discuss.rmiitf.DiscussMaintain;
import com.yonyou.pmclouds.discuss.rmiitf.DiscussQuery;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/mobile/pressure")
public class PressureTestController {
    @Reference(version = ApplicationConsts.APPLICATION_VERSION)
    private DiscussQuery query;
    @Reference(version = ApplicationConsts.APPLICATION_VERSION)
    private DiscussMaintain maintain;

    @GetMapping("test")
    public DiscussionVO[] getInt(@RequestParam("p") String p) throws BusinessException {
        return query.queryDiscussByRelateKey("00755d5c-8e1c-4ae2-b03a-aa5f07075b95", null);
    }

    @PostMapping("test2")
    public int test(@RequestBody DiscussionVO discussion) throws BusinessException {
        discussion.setCreator("2fd4d7a6-722d-4a45-a4fb-03521875dbe0");
        discussion.setCreatorName("4444");
        maintain.makeDiscussion(discussion);
        return 1;
    }

}
